#define _CRT_SECURE_NO_WARNINGS 1

int romanToInt(char* s)
{
	int sum = 0;
	while (*s)
	{
		if (*s == 'I')
		{
			if (*(s + 1) == 'V'||*(s+1) =='X')
				sum -=1;
			else
				sum += 1;
		}
		if (*s == 'X')
		{
			if (*(s + 1) == 'L' || *(s + 1) == 'C')
				sum -= 10;
			else
				sum += 10;
		}
		if (*s == 'C')
		{
			if (*(s + 1) == 'D' || *(s + 1) == 'M')
				sum -= 100;
			else
				sum += 100;
		}
		if (*s == 'V')
			sum += 5;
		if (*s == 'L')
			sum += 50;
		if (*s == 'D')
			sum += 500;
		if (*s == 'M')
			sum += 1000;
		s++;
	}
	return sum;
}